<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>反馈</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="__CSS__/switch.css">
    <style type="text/css">
        body{background: #f5f3f3;}
        .top_span_l{display: inline-block;width: 30%;}
        .top_span_m{display: inline-block;width: 30%;text-align: center;}
        .top_span_r{display: inline-block;width: 30%;text-align: right;}
        .txt{font-size: 16px; box-sizing: border-box; resize: none; outline: none; padding: 10px 6px; height: 180px; display: flex; width: 100%; border: none;}
    </style>
    <script src='__JS__/jquery.min.js'></script>
    <script type="text/javascript" src="__JS__/layer.js"></script>
</head>
<body>
<!-- 顶部固定导航 -->
<nav class="navbar navbar-default" style="padding-top: 5px;background-color: rgb(66, 185, 131);font-size: 25px;color: white;margin-bottom: 0px;">
    <span class="glyphicon glyphicon-remove top_span_l"></span>
    <span class="top_span_m">发布</span>
    <span class="glyphicon glyphicon-ok top_span_r"></span>
</nav>
<!-- 中部帖子具体内容 -->
<div>
    <form>
        <textarea class="form-control txt" rows="5" style="background: white;"></textarea>
    </form>
</div>
<!-- 底部发送 -->
<div class="container" style="padding-top: 10px;">
    <div id="div1" class="close1" style="float: left;">
        <div id="div2" class="close2"></div>
    </div>    
    <span style="display: inline-block;vertical-align: middle;height: 40px;font-size: 16px;float: left;padding-top: 10px;text-align: center;">匿名</span>
	<span style="display: inline-block;width: 40%;float: right;text-align: right;">
		<button id="sub" class="btn btn-md" style="color: green;border-radius: 10px;">SEND</button>
	</span>
    <div style="clear: both;"></div>
</div>
<!-- JS脚本版块 -->
<script type="text/javascript">
    window.onload=function(){
        var div2=document.getElementById("div2");
        var div1=document.getElementById("div1");
        div2.onclick=function(){
          div1.className=(div1.className=="close1")?"open1":"close1";
          div2.className=(div2.className=="close2")?"open2":"close2";
        }
    }
    $('.top_span_l').click(function() {
        location.href="{:U('Home/Index/ucenter')}";
    });
    //点击 提交 留言
    $('#sub').click(function(){
        var flag    =   $('#div1').hasClass('close1') ? 1 : 0;  //默认状态是 关闭 匿名
        var contents    =   $('.txt').val();

        if(contents.length<=0){
            layer.open({
                content: '帖子信息不能为空！！！'
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
            });
            return false;            
        }

        $.ajax({
            type:'post',
            url:"{:U('Home/Index/tickling')}",
            data:{flag:flag,contents:contents},
            dataType:'json',
            success:function(res){
                if(res.state!=1){   //评论失败
                    layer.open({
                        content: res.msg
                        ,skin: 'msg'
                        ,time: 2 //2秒后自动关闭
                    });
                }else{
                    location.href="{:U('Home/Index/ucenter')}";
                }
            }
        });
    });
        
</script>
</body>
</html>